package net.zjitc.abstracts.grade;

/**
 * @Author admin
 * @Date 2019/3/22 7:56
 */
public class Test {
    public static void main(String[] args) {
        /* 利用多态创建4个学生对象 */
        Student[] students=new Student[4];
        students[0]=new CollegeStudent("张三");
        students[1]=new CollegeStudent("李四");
        students[2]=new Undergraduate("Lily");
        students[3]=new Undergraduate("Lucy");
        /* 给4个学生设置一样的分数,计算等级 */
        float[] score={87,90,78};
        for (int i = 0; i <students.length ; i++) {
            students[i].setCourses(score);
            students[i].calculateGrade();
        }
        System.out.println("姓名\t类型\t等级");
        /* 输出4个学生的姓名、类型、等级*/
        for (int i = 0; i < students.length; i++) {
            System.out.println(students[i].getName()+"\t"+
                    students[i].getType()+"\t"+
                    students[i].getCourseGrade()
            );
        }
    }
}
